package com.jt.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
//指定配置文件进行加载
@PropertySource("classpath:/properties/redis.properties")
public class RedisController {
    /**
     * 当程序启动时，会自
     */
//    @Value("${spring.redis.host}")
    private String ip;
//    @Value("${spring.redis.port}")
    private int port;

    @RequestMapping("/doGetNode")
    public String doGetNode(){
        return ip+"."+port;
    }





    //2、通过properties方式赋值
    @Value("${redis2.host}")
    private String ipp;
    @Value("${redis2.port}")
    private int portt;

    @RequestMapping("/getNode")
    public String getNode(){
        return ipp+"."+portt;
    }
































}
